package com.example.demo.service;

import com.example.demo.bean.Teams;
import com.example.demo.dao.TeamsDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class TeamsService {
    @Autowired
    TeamsDao dao;

    public List<Teams> getAll() {
        return dao.findAll();
    }

    public Teams findById(Integer id) {
        Optional<Teams> byId = dao.findById(id);
        return byId.get();
    }
}
